package com.mz.ozy.mvp.presenter;

import android.content.Context;

import com.google.gson.Gson;
import com.mz.ozy.base.BasePresenterImpl;
import com.mz.ozy.bean.AlipayAuthBean;
import com.mz.ozy.bean.EventBean;
import com.mz.ozy.bean.LoginBean;
import com.mz.ozy.constants.Constants;
import com.mz.ozy.mvp.model.LoginModel;
import com.mz.ozy.mvp.model.SetPassModel;
import com.mz.ozy.mvp.view.LoginContract;
import com.mz.ozy.mvp.view.SetPassContract;
import com.mz.ozy.net.MyObserver;
import com.mz.ozy.utils.AppUtils;
import com.mz.ozy.utils.RxUtil;

import org.greenrobot.eventbus.EventBus;
import org.json.JSONObject;

import okhttp3.ResponseBody;

/**
 * Created by administrator on 2018/12/3.
 */
public class SetPassPresenter extends BasePresenterImpl<SetPassContract.View> implements SetPassContract.Presenter {

    private SetPassModel mModel;

    public SetPassPresenter() {
        mModel = new SetPassModel();
    }


    @Override
    public void setPassword(final Context context, final String invitecode, String password, String repass) {
        mModel.setPassword(context, invitecode, password, repass)
                .compose(RxUtil.rxSchedulerHelper(mView.<ResponseBody>bindToLifecycle()))
                .subscribe(new MyObserver<LoginBean>(mView) {

                    @Override
                    public void onSuccesss(LoginBean loginBean) {
                        mView.setPassSuccess(loginBean);
                    }
                });
    }

}
